package starblaze 
{
  import starblaze.error.MissingAttributeError;
	
  internal final class AttributeVerifer 
  {
    
    public function AttributeVerifer(outputStreamFormat:StreamFormat, internalStreamFormat:StreamFormat) 
    {
      m_outputStreamFormat = outputStreamFormat;
      m_internalStreamFormat = internalStreamFormat;
    }
    
    internal var m_outputStreamFormat:StreamFormat = null;
    internal var m_internalStreamFormat:StreamFormat = null;
    
    internal function require(attribute:Attribute):void
    {
      var attr:Attribute = null;
      
      for each (attr in m_outputStreamFormat)
        if (attr.equals(attribute))
          return;
      
      for each (attr in m_internalStreamFormat)
        if (attr.equals(attribute))
          return;    
      
      throw new MissingAttributeError(attribute);
    }
    
  }

}
